﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using clf.weighing.entity;

namespace weighing
{
    /// <summary>
    /// 室外高频读卡器 视图类
    /// </summary>
    public class OutIcReaderVo : BaseVo
    {
        #region Constract
        public OutIcReader mOutIcReader;
        public OutIcReaderVo(OutIcReader outIcReader)
        {
            mOutIcReader = outIcReader;
        }
        #endregion

        #region Property 
        public Int64 Id
        {
            get
            {
                return mOutIcReader.id;
            }
            set
            {
                mOutIcReader.id = value;
                OnPropertyChanged(this, nameof(Id));
            }
        }


        public String Name
        {
            get
            {
                return mOutIcReader.name;
            }
            set
            {
                mOutIcReader.name = value;
                OnPropertyChanged(this, nameof(Name));
            }
        }

        /// <summary>
        /// 注释:默认为 （0：入场，1：出场）
        /// 可空:NO
        /// 默认值:0
        /// </summary>
        public Int32 DefaultType
        {
            get
            {
                return mOutIcReader.defaultType;
            }
            set
            {
                mOutIcReader.defaultType = value;
                OnPropertyChanged(this, nameof(DefaultType));
            }
        }


        public String Ip
        {
            get
            {
                return mOutIcReader.ip;
            }
            set
            {
                mOutIcReader.ip = value;
                OnPropertyChanged(this, nameof(Ip));
            }
        }

        public Int32? Port
        {
            get
            {
                return mOutIcReader.port;
            }
            set
            {
                mOutIcReader.port = value;
                OnPropertyChanged(this, nameof(Port));
            }
        }

        /// <summary>
        /// 注释:状态 （0：停用，1：启用）
        /// 可空:NO
        /// 默认值:1
        /// </summary>

        public Int32 Status
        {
            get
            {
                return mOutIcReader.status;
            }
            set
            {
                mOutIcReader.status = value;
                OnPropertyChanged(this, nameof(Status));
            }
        }
        /// <summary>
        /// 注释:关联的磅称
        /// 可空:YES
        /// 默认值:0
        /// </summary>
        public Int64? ScaleId
        {
            get
            {
                return mOutIcReader.scaleId;
            }
            set
            {
                mOutIcReader.scaleId = value;
                OnPropertyChanged(this, nameof(ScaleId));
            }
        }
        /// <summary>
        /// 注释:客户端Id
        /// 可空:YES
        /// 默认值:0
        /// </summary>
        public Int64? ClientId
        {
            get
            {
                return mOutIcReader.clientId;
            }
            set
            {
                mOutIcReader.clientId = value;
                OnPropertyChanged(this, nameof(ClientId));
            }
        }

        /// <summary>
        /// 注释:通信方试(0 :Com ,1 :485,2 :ip)
        /// 可空:YES
        /// 默认值:0
        /// </summary>

        public Int32? ConmunicationType
        {
            get
            {
                return mOutIcReader.conmunicationType;
            }
            set
            {
                mOutIcReader.conmunicationType = value;
                OnPropertyChanged(this, nameof(ConmunicationType));
            }
        }

        public String Com
        {
            get
            {
                return mOutIcReader.com;
            }
            set
            {
                mOutIcReader.com = value;
                OnPropertyChanged(this, nameof(Com));
            }
        }

        /// <summary>
        /// 注释:波特率
        /// 可空:YES
        /// 默认值:0
        /// </summary>

        public Int32? BaudRate
        {
            get
            {
                return mOutIcReader.baudRate;
            }
            set
            {
                mOutIcReader.baudRate = value;
                OnPropertyChanged(this, nameof(BaudRate));
            }
        }

        /// <summary>
        /// 注释:品牌类型(0:未知,1:昱闵,2 明华高频桌面 3明华高频(室外),4明华普通)
        /// 可空:NO
        /// 默认值:0
        /// </summary>

        public ICReaderBrandType BrandType
        {
            get
            {
                return (ICReaderBrandType)mOutIcReader.brandType;
            }
            set
            {
                mOutIcReader.brandType = (int)value;
                OnPropertyChanged(this, nameof(BrandType));
            }
        }

        public DateTime? AddTime
        {
            get
            {
                return mOutIcReader.addTime;
            }
            set
            {
                mOutIcReader.addTime = value;
                OnPropertyChanged(this, nameof(AddTime));
            }
        }
        #endregion

        #region TEXT 

        public String ConmunicationText
        {
            get
            {
                return CommonFunction.ConmunicationTypeText(ConmunicationType);
            }
        }



        public string DefaultTypeText { get { return mOutIcReader.defaultType == 0 ? "入场" : "出场"; } }
        #endregion
    }
}

